import * as actionTypes from '../../constants/ActionType';

const initialState = {
  userList:[],
  //show:false,
  user:{}
};

// const initUserInfo = {
//   show:false,
//   user:{}
// };

export function userReducer(state = initialState, action){
  switch (action.type){
    case actionTypes.SEL_USER :
    const newData = action.data;
      console.log(state);
      console.log("呵呵");
      console.log(newData);
      return {
        ...state,
        ...newData
      };
    case actionTypes.SEL_USER_INFO:
    const newData1 = action.data;
      console.log("makeUserR");
      console.log(newData);
      return {
          ...state,
          ...newData1
      };
    case actionTypes.DEL_USER:
      console.log('删除');
      return state;
    default :
      return state;
  }
}

// export const userMakeReducer = (state = initUserInfo, action) => {
//   console.log("xxxxxxxxxxxxxx");
//   switch (action.type) {
//     case actionTypes.SEL_USER_INFO:
//     let newData = action.data;
//     console.log("makeUserR");
//     console.log(newData);
//     return {
//         ...state,
//         ...newData
//       }
//     default:
//       return state
//   }
// }
